package com.jiajia.study.listener;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.nio.charset.StandardCharsets;

/**
 * @Title: RabbitMessageListener
 * @Author zjj
 * @Package com.jiajia.study.listener
 * @Date 2024/3/8 12:43
 * @description:
 */
@Slf4j
@Component
public class RabbitMessageListener {

    @RabbitListener(queues = {"topic.queue.a","topic.queue.b","topic.queue.c","topic.queue.d"})
    public void receive(Message message){

        byte[] body = message.getBody();
        String msg = new String(body, StandardCharsets.UTF_8);
        log.info("receive message : [{}]",msg);

    }
}
